<template>
	<view class="box">
		<view class="tou top" :style="'padding-top:' + statusBarHeight1 + 'px'">
			<image @click.stop="fanhui" class="image1"
				src="https://pic.bangbangtongcheng.com/8937350f727e4eeda6e97ab0d7398e65" />
			<!-- #ifndef MP-WEIXIN -->
			会员礼品赠送
			<!-- #endif -->
			<!-- #ifdef MP-WEIXIN -->
			<text @click="fanhui" style="margin-left:75rpx">会员礼品赠送</text>
			<!-- #endif -->
		</view>



		<barcode id='1' class="barcode" :autostart="true" ref="barcode" background="rgb(0,0,0)" frameColor="#1C86EE"
			scanbarColor="#1C86EE" :filters="fil" @marked="success" @error="fail"></barcode>
			
			
	</view>
</template>

<script>
	export default {
		data() {
			return {
				fil: [0, 2],
				islight: false,
				scanHight: null,
				statusBarHeight1: null,
			}; 
		},
		onLoad() {
			let that = this
			this.statusBarHeight1 = uni.statusBarHeight1
			uni.getSystemInfo({
				success: function(res) {
					that.scanHight = res.screenHeight
				}
			})
		},
		onReady() {
			this.toscan() 
		},
		methods: {
			success() {

			},
			fail() {

			},
			
			toStart: function() {
							this.$refs.barcode.start({
								conserve: true,
								filename: '_doc/barcode/'
							});
						},
						tocancel:function(){
							this.$refs.barcode.cancel();
						},
						toFlash: function() {
							this.$refs.barcode.setFlash(true);
						},
			
						toscan: function() {
							console.log("scan:");				
							const barcodeModule = uni.requireNativePlugin('barcodeScan');
							barcodeModule.scan("/static/barcode1.png"
							,(e)=>{
								console.log("scan_error:"+JSON.stringify(e));
							});
						}
		}
	}
</script>

<style lang="scss">
	.barcode {
		position: fixed;
		top: 0%;
		bottom: 0%;
		left: 0%;
		right: 0%;
	}

	page {}

	.box {
		width: 750rpx;
		min-height: 100vh;
	}

	.tou {
		position: relative;
		width: 100%;
		// height: 88rpx;
		text-align: center;
		line-height: 88rpx;
		font-size: 36rpx;
		color: #fff;

		.image1 {
			position: absolute;
			width: 32rpx;
			height: 32rpx;
			// top: 116rpx;
			left: 30rpx;
		}

		.image2 {
			position: absolute;
			width: 56rpx;
			height: 56rpx;
			// top: 104rpx;
			right: 30rpx;
		}

		p {
			position: absolute;
			// top: 90rpx;
			line-height: 45rpx;
			bottom: 21rpx;
			right: 30rpx;
			font-size: 32rpx;
			color: #fff;
		}
	}
</style>